/**
 * Created by liubin on 2014/7/27.
 */
'use strict';

define(['angular', 'services'], function (angular, services) {
    services.factory('roleListService', ['$resource', 'baseService', function ($resource, baseService) {
            var res = $resource(urlRoute.getUrl('api_rolelist'), {}, {
                get: {method: 'get'},
                post: {method: 'post'}
            });
            var listSev = {};
            angular.forEach(['get', 'post'], function (value, key) {
                this[value] = function (args, posts, successFunc, failtureFunc, errorFunc) {
                    baseService.process(res, value, args, posts, successFunc, failtureFunc, errorFunc);
                }
            }, listSev);
            return listSev;
        }]
    ).factory('userService', ['$resource', 'baseService', function ($resource, baseService) {
            var res = $resource(urlRoute.getUrl('api_rolelist') + '/:id',
                {
                    id: '@id'
                },
                {
                    get: {method: 'get'},
                    put: {method: 'put'},
                    delete: {method: 'delete'}
                }
            );
            var listSev = {};
            angular.forEach(['get', 'put', 'delete'], function (value, key) {
                this[value] = function (args, posts, successFunc, failtureFunc, errorFunc) {
                    baseService.process(res, value, args, posts, successFunc, failtureFunc, errorFunc);
                }
            }, listSev);
            return listSev;
        }]
    );
});